<template>
  <div class="x-bar">
    <div :id="id" :option="option":class="className" :style="{height:height,width:width}"></div>
  </div>
</template>
<script>
  import HighCharts from 'highcharts'
  import resize from './mixins/resize'
  export default {
    mixins: [resize],
    // 验证类型
    props: {
      className: {
        type: String,
        default: 'chart'
      },
      width: {
        type: String,
        default: '100%'
      },
      height: {
        type: String,
        default: '100%'
      }
    },
    data() {
      return {
        id: 'pie',
        option: {
          chart: {
            type: 'pie',
            backgroundColor: 'rgba(0,0,0,0)',
            options3d: {
              enabled: true,
              alpha: 45
            }
          },
          title: {
            text: '检测报告统计:(34份)',
            style: {
              color: 'white'
            }
          },
          plotOptions: {
            pie: {
              depth: 75,
              colors: ['#C1232B', '#E87C25', '#26C0C0']
            }
          },
          series: [{
            name: '检测报告',
            data: [
              ['磁粉检测', 23],
              ['超声检测', 10],
              ['其他检测', 1]
            ]
          }]
        }
      }
    },
    mounted() {
      HighCharts.chart(this.id, this.option)
    }
  }
</script>
